import { Component, OnInit, Input } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { PageModalService } from 'src/app/shared/service/page-modal-service';
import { VideoImgPopupComponent } from '../video-img-popup/video-img-popup.component';


@Component({
    selector: 'app-case-top-list',
    templateUrl: './case-top-list.component.html',
    styleUrls: ['./case-top-list.component.scss'],
})
export class CaseTopListComponent implements OnInit {
    @Input() tagData: any;
    constructor(
        private pageModalService: PageModalService,
        public modalController: ModalController,
    ) { }

    ngOnInit() {
    }
    openPage(link) {
        this.pageModalService.openPage(link);
    }

    // 打开图片展示框，滑动展示
    openImage(index, images) {
        this.pageModalService.openImage_url(index, images);
    }

    async popup(data, title, link) {
        if (title) {
            this.openPage(link);
        } else {
            const modal = await this.modalController.create({
                component: VideoImgPopupComponent ,
                componentProps: { tagData: data}
            });
            return await modal.present();
        }
    }
}
